<?php
/***********************************************************
	Filename: app/www/control/search.php
	Note	: 信息搜索
	Version : 3.0
	Author  : qinggan
	Update  : 2010-05-20
***********************************************************/
class search_c extends Control
{
	function __construct()
	{
		parent::Control();
		$this->load_model("search");
	}

	function search_c()
	{
		$this->__construct();
	}

	function index_f()
	{
		$this->search_m->langid($_SESSION["sys_lang_id"]);
		$keywords = $this->trans_lib->safe("keywords");
		$this->tpl->assign("keywords",$keywords);
		$sitetitle = "站内搜索";
		$this->tpl->assign("sitetitle",$sitetitle);
		$array[0]["title"] = "站内搜索";
		$this->tpl->assign("leader",$array);
		$total = $this->search_m->get_count($keywords);
		if($total < 1)
		{
			error("没有检索您要的信息，请检查...",$this->url());
		}
		$pageid = $this->trans_lib->int(SYS_PAGEID);
		$offset = $pageid>1 ? ($pageid-1)*SYS_PSIZE : 0;
		$rslist = $this->search_m->get_list($offset,$keywords);
		$this->tpl->assign("rslist",$rslist);
		$pageurl = $this->url("search")."keywords=".rawurlencode($keywords);
		$pagelist = $this->page_lib->page($pageurl,$total,true,false);
		$this->tpl->assign("pagelist",$pagelist);
		$this->tpl->display("search.".$this->tpl->ext);
	}
}
?>